<<<<<<< HEAD:first homework/f22015313_胡先佳/Duck.java
package com.example.homeworka;
=======
package com.example.f22011208;
>>>>>>> 8e2bcaf (Android):first homework/f22011208魏嘉/Duck.java

public abstract class Duck {
    FlyBehavior flyBehavior;
    QuackBehavior quackBehavior;

    public void performQuack(){
        //System.out.println("呱呱叫");
        quackBehavior.quack();
    }

    public void performFly(){
        flyBehavior.fly();
    }

    public abstract void display();

    public void swim(){
        System.out.println("我会游泳");
    }

    public void setFlyBehavior(FlyBehavior flyBehavior) {
        this.flyBehavior = flyBehavior;
    }

    public void setQuackBehavior(QuackBehavior quackBehavior) {
        this.quackBehavior = quackBehavior;
    }
}